//1、加载待测试的js文件
load("js/biz.js");

//2、编写测试用例
var testActions = {
  "测试业务方法1" : function() {
      assertEquals(2, biz1(), 0)
  },
  "测试业务方法2" : function() {
      assertEquals(3, biz2(), 0)
  },
  "测试业务方法3" : function() {
      assertEquals(4, biz3(), 0)
  },
  "测试业务方法4" : function() {
      assertEquals(5, biz4(), 0)
  },
  "打印请求结果" : function() {
      assertEquals("aa", biz5())
  },
  "上下文传值与锁定测试" : function() {
    biz6()
    context.put("a", 2)
    context.lockUnModifiableMap()

    context.put("b", "test")
    assertEquals(2, context.get("a"), 0)
    assertEquals("test", context.get("b"))
  },

  "JDBC操作测试" : function() {
    biz7()
  },

  "java类的引入和一些函数式特性测试" : function() {
    assertEquals(1, biz8(), 0)
  },
  "console方法测试" : function() {
    biz9()
  },
  "forEach测试" : function() {
    biz10()
  },
  "内建属性" : function() {
    print(__FILE__, __LINE__, __DIR__)
    print("hello", "world")
  },
  "load函数测试" : function() {
    // can load script from files, URLs

    load("js/foo.js"); // loads script from file "foo.js" from current directory
    // load("https://ss1.bdstatic.com/5eN1bjq8AAUYm2zgoY3K/r/www/cache/static/protocol/https/global/js/all_async_search_554eccd.js"); // loads script file from given URL

// loads script from an object's properties.

// Object should have "script" and "name" properties.
//     "script" property contains string code of the script.
//     "name" property specifies name to be used while reporting errors from script
// This is almost like the standard "eval" except that it associates a name with
// the script string for debugging purpose.

    load({ script: "print('hello')", name: "myscript.js"})

// load can also load from pseudo URLs like "nashorn:", "fx:", "classpath:"

// "nashorn:" pseudo URL scheme
// for nashorn's built-in scripts.

// load nashorn's parser support script - defines 'parse'
// function in global scope

    // load("nashorn:parser.js");

// load Mozilla compatibility script - which defines global functions
// like importPackage, importClass for rhino compatibility.

    // load("nashorn:mozilla_compat.js");

// "fx:" pseudo URL scheme for JavaFX support scripts
// "classpath:" pseudo URL scheme to load scripts from jjs classpath jars and directories

    // load("classpath:foo.js"); // load the first foo.js found in jjs -classpath dir
  },
  "for each测试二" : function() {
      biz11()
  },
  "测试LOgger": function(){
    // biz12()
    // biz13()
  }
}

//3、执行测试
tests(testActions)
